<?php
session_start();
include_once 'classes/DBCon.php';
include_once 'classes/Forum.php'
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Railway Official Website</title>
        <link rel="stylesheet" href="css/foundation.css"/>
        <link rel="stylesheet" href="css/normalize.css"/>
        <link rel="stylesheet" href="css/jquery-ui.css" />
        <script src="js/ui/jquery-ui.js"></script>
        <script src="js/vendor/jquery.js"></script>
        <script src="js/vendor/custom.modernizr.js"></script>
        <script src="js/formValidation.js"></script>
        <style type="text/css">
		#wrap {display:table;height:100%}
        fieldset { border:2px solid grey }
        legend {
              padding: 0.2em 0.5em;
              border:2px solid white;
              color:black;
              font-size:150%;
              text-align:left;
        }                
	</style>
        <title></title>
    </head>
    <body>
        <div>
            <nav class="top-bar">
                <ul class="title-area">
                    <li class="name" onClick="void(0);">
                        <h1><a href="ForumMain.php">Railway Community Forum</a></h1>
                    </li>
                    <li class="divider"></li>
                    <li class="toggle-topbar menu-icon">
                        <a href="#"><span>menu</span></a>
                    </li>
                </ul>
                <section class="top-bar-section">
                    <ul class="right">
                        <li class="divider"></li>
                        <li><a href="index.php">Home</a></li>
                        <li class="divider"></li>
                        <?php
                        if (isset($_SESSION['username'])) {
                            echo '<li><a href="profile.php">Welcome, ' . $_SESSION['username'] . '!</a></li>';
                            echo '<li class="divider"></li>';
                            echo '<li><a href="logout.php">Logout</a></li>';
                            echo '<li class="divider"></li>';
                        }
                        else{
                            echo '<li><a href="loginPage.php">Login</a></li>';
                            echo '<li class="divider"></li>';
                            echo '<li><a href="register.php">Register</a></li>';
                            echo '<li class=divider"></li>';
                        }
                        ?>
                    </ul>
                </section>
            </nav>
        </div>
        
        <div>
            <?php
                //Display Forum Board
            if(isset($_SESSION['username'])){
                $frm = new Forum();
                $frm->displayForumBoard();
                
            }else{
                echo '<p align="center">Please login to view the Forum!!</p>';
                echo '<p align="center"><a href="loginPage.php">Click Here</a> to Login!</p>';
            }
            ?>
        
        </div>
        <div class="row">
            <fieldset>
                <legend>Information</legend>
            <?php 
                include ("classes/OnlineTime.php"); 
                $test = new OnlineTime(); 

                echo "<br> Curent time on page: ";
                $test -> display_time("current_page"); // will display the time the user spent on the current page (dinamyc)

                echo "<br> Total time on site: "; 
                $test -> display_time("total_time"); // will display the time the user spent on the site from all the visits (dinamyc) 
                
                echo '<br>Latest registered member : ';
                
                echo '<br> No. of online user : ';
                
                echo '<br>User that is online :';
            ?>
            </fieldset>
        </div>
        
        
        <div  id="footer_wrap">
            <div id="footer">
                <div id="footer_right">
                    <p align="right">Forum made by Jason Powered by Rail Way System.</p>
                </div> 
            </div> <!-- End footer-->
        </div> <!-- End footer_wrap-->

            <script type="text/javascript&quot; src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
            <script type="text/javascript">
                    $('input, textarea').click(function(){
                            $(this).select();
                    });
                if ($("#message_header p").html()) {
                            setTimeout(function() {
                                    $("#message_header").slideUp('slow');
                            }, 5000);
                    }
             </script>
    </body>
</html>
